cmake_minimum_required(VERSION 3.10)

project(ffmpeg_decodec)

add_executable(${PROJECT_NAME} main.cpp)

find_package(PkgConfig)
if (PkgConfig_FOUND)
    pkg_check_modules(FFmpeg libavformat>=58 libavcodec>=58 libavutil>=56 libswscale>=5)
    if (FFmpeg_FOUND)
        target_link_options(${PROJECT_NAME} PRIVATE ${FFmpeg_LDFLAGS})
        target_compile_options(${PROJECT_NAME} PRIVATE ${FFmpeg_CFLAGS})
        set(EXTERNAL_LIBS_FFMPEG ${FFmpeg_LIBRARIES})
    endif ()
endif ()

target_link_libraries(${PROJECT_NAME} PRIVATE ${EXTERNAL_LIBS_FFMPEG})
